import request from "./config";

// 通用登录
export function login(data) {
  return request({
    url: "/common/login",
    headers: {
      isToken: false,
    },
    method: "post",
    data: data,
  });
}

//获取首页数据
export function getDataInfo() {
  return request({
    url: "/admin/getDataInfo",
    method: "get",
  });
}

//获取分类 
export function getClass(params) {
  return request({
    headers: {
      isToken: false,
    },
    url: "/common/getClass",
    method: "get",
    params
  });
}


//添加文章
export function addArticle(data) {
  return request({
    url: "/admin/addArticle",
    method: "post",
    data: data,
  });
}

//获取文章列表
export function getArticle(params) {
  return request({
    url: "/common/getArticle",
    method: "get",
    params,
  });
}

//删除文章
export function delArticle(data) {
  return request({
    url: "/admin/delArticle",
    method: "delete",
    data
  });
}

//根据id修改文章信息
export function setArticle(data) {
  return request({
    url: "/admin/setArticle",
    method: "put",
    data,
  });
}

//根据id 获取文章
export function getArticleInfo(params) {
  return request({
    url: "/common/getArticleInfo",
    method: "get",
    params
  });
}
//修改分类
export function setClass(data) {
  return request({
    url: "/admin/setClass",
    method: "put",
    data,
  });
}
//增加分类
export function addClass(data) {
  return request({
    url: "/admin/addClass",
    method: "post",
    data,
  });
}
//删除分类
export function delClass(data) {
  return request({
    url: "/admin/delClass",
    method: "delete",
    data,
  });
}
//获取页面数据
export function getPageInfo() {
  return request({
    url: "/common/getPageInfo",
    method: "get",
  });
}
//修改页面数据
export function setPageinfo(data) {
  return request({
    url: "/admin/setPageinfo",
    method: "put",
    data
  });
}
//获取用户
export function getUser(params) {
  return request({
    url: "/admin/getUser",
    method: "get",
    params
  });
}
//新增用户
export function addUser(data) {
  return request({
    url: "/admin/adduser",
    method: "post",
    data
  });
}
//删除用户
export function delUser(data) {
  return request({
    url: "/admin/delUser",
    method: "delete",
    data
  });
}
//修改用户信息
export function setUser(data) {
  return request({
    url: "/admin/setUser",
    method: "put",
    data,
  });
}
//查看评论 
export function getComment(params) {
  return request({
    url: "/admin/getComment",
    method: "get",
    params
  });
}
//修改评论
export function setComment(data) {
  return request({
    url: "/admin/setComment",
    method: "put",
    data
  });
}
//删除评论
export function delComment(data) {
  return request({
    url: "/admin/delComment",
    method: "delete",
    data
  });
}
//获取导航
export function getNav(params) {
  return request({
    url: "/common/getNav",
    method: "get",
    params,
  });
}
//增加导航
export function addNav(data) {
  return request({
    url: "/admin/addNav",
    method: "post",
    data,
  });
}
//修改导航
export function setNav(data) {
  return request({
    url: "/admin/setNav",
    method: "put",
    data,
  });
}
//删除导航
export function delNav(data) {
  return request({
    url: "/admin/delNav",
    method: "delete",
    data,
  });
}
//获取系统配置
export function getSystem() {
  return request({
    url: "/common/getsystem",
    method: "get",
  });
}
//修改系统配置
export function setSystem(data) {
  return request({
    url: "/admin/setsystem",
    method: "put",
    data,
  });
}
//获取用户信息
export function getUserInfo(params) {
  return request({
    url: "/common/getUserInfo",
    method: "get",
    params
  });
}
//修改用户信息
export function setUserInfo(data) {
  return request({
    url: "/admin/setUserInfo",
    method: "put",
    data,
  });
}
//管理员修改密码
export function setAdminPwd(data) {
  return request({
    url: "/admin/setAdminPwd",
    method: "put",
    data,
  });
}






















//模糊查询用户
export function getlikeuser(data) {
  return request({
    url: "/api/getlikeuser",
    method: "post",
    data: data,
  });
}


//获取分类
export function getclassarticle() {
  return request({
    url: "/api/getclassarticle",
    method: "get",
  });
}

//获取文章
export function article(data) {
  return request({
    url: "/api/article",
    method: "post",
    data,
  });
}





//搜索文章分页
export function getlikearticle(data) {
  return request({
    url: "/api/getlikearticle",
    method: "post",
    data,
  });
}





















